import Vue from 'vue'
import App from './App'
import uView from "uview-ui";
import share from "./common/share.js"
Vue.mixin(share)
Vue.use(uView);


Vue.config.productionTip = false

App.mpType = 'app'

uni.$showMsg = (title = "数据加载失败!", duration = 1500) => {
	uni.showToast({
		title,
		duration,
		icon: "none"
	})
}


Vue.filter('htmlImage', function(html) {
	function formatRichText(html) {
		let newContent = html.replace(/<img[^>]*>/gi, function(match, capture) {
			match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
			match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
			match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
			return match;
		});
		newContent = newContent.replace(/style="[^"]+"/gi, function(match, capture) {
			match = match.replace(/width:[^;]+;/gi, 'width:100%;').replace(/width:[^;]+;/gi, 'width:100%;');
			return match;
		});
		newContent = newContent.replace(/<br[^>]*\/>/gi, '');
		newContent = newContent.replace(/\<img/gi, '<img style="width:100%;height:auto;display:block;margin:10px 0;"');
		return newContent;
	}


})


const app = new Vue({
	...App
})
app.$mount()
